import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/data/entities/application/securtity_base_drawer.dart';
import 'package:enterprise_v6_app/app/modules/application/inventory_system/daily_inspection_checklist/daily_inspection_checklist_view.dart';
import 'package:enterprise_v6_app/app/modules/application/inventory_system/department_responsibility_list/department_responsibility_list_view.dart';
import 'package:enterprise_v6_app/app/modules/application/inventory_system/emergency_checklist/emergency_checklist_view.dart';
import 'package:enterprise_v6_app/app/modules/application/inventory_system/job_operation_list/job_operation_list_view.dart';
import 'package:enterprise_v6_app/app/modules/application/inventory_system/job_performance_checklist/job_performance_checklist_view.dart';
import 'package:enterprise_v6_app/app/modules/application/inventory_system/list_main_responsibilities/list_main_responsibilities_view.dart';
import 'package:enterprise_v6_app/app/modules/application/inventory_system/personnel_performance_checklist/personnel_performance_checklist_view.dart';
import 'package:enterprise_v6_app/app/modules/application/inventory_system/risk_control_checklist/risk_control_checklist_view.dart';

class InventorySystemController extends GetxController {
  /// scaffoldKey
  final scaffoldKey = GlobalKey<ScaffoldState>();
  /// 筛选右侧栏控制Key
  final riskRightScaffoldKey = GlobalKey<ScaffoldState>();
  /// 选中的页面
  int selectIndex = 0;
  var filterWidget = Rx<Widget>(Container());
  final titleList = [
    SecurityBaseEntity(
      title: '主体责任清单',
      icon: AppImages.icon_main_responsibilities_page,
      expandTitle: '主体责任清单',
      currentPageTitle: 0,
      pages: [ListMainResponsibilitiesPage()],
    ),
    SecurityBaseEntity(
      title: '部门责任清单',
      icon: AppImages.icon_department_responsibility_page,
      expandTitle: '部门责任清单',
      currentPageTitle: 0,
      pages: [DepartmentResponsibilityListPage()],
    ),
    SecurityBaseEntity(
      title: '岗位操作清单',
      icon: AppImages.icon_job_operation_list_page,
      expandTitle: '岗位操作清单',
      currentPageTitle: 0,
      pages: [JobOperationListPage()],
    ),
    SecurityBaseEntity(
      title: '岗位履责清单',
      icon: AppImages.icon_job_performance_check_page,
      expandTitle: '岗位履责清单',
      currentPageTitle: 0,
      pages: [JobPerformanceChecklistPage()],
    ),
    SecurityBaseEntity(
      title: '人员履责清单',
      icon: AppImages.icon_personnel_performance_check_page,
      expandTitle: '人员履责清单',
      currentPageTitle: 0,
      pages: [PersonnelPerformanceChecklistPage()],
    ),
    SecurityBaseEntity(
      title: '风险管控清单',
      icon: AppImages.icon_risk_control_check_page,
      expandTitle: '风险管控清单',
      currentPageTitle: 0,
      pages: [RiskControlChecklistPage()],
    ),
    SecurityBaseEntity(
      title: '日常巡检清单',
      icon: AppImages.icon_daily_inspection_check_page,
      expandTitle: '日常巡检清单',
      currentPageTitle: 0,
      pages: [DailyInspectionChecklistPage()],
    ),
    SecurityBaseEntity(
      title: '应急清单',
      icon: AppImages.icon_emergency_drill_list_page,
      expandTitle: '应急清单',
      currentPageTitle: 0,
      pages: [EmergencyChecklistPage()],
    ),
  ];

  /// title选择切换
  /// [titleIndex] 标题索引
  /// [index] 页面索引
  void selectTitle(int titleIndex, int index) {
    titleList[titleIndex].currentPageTitle = index;
    update();
  }

  /// 点击左侧菜单
  /// [index] 索引
  void selectLeftMenu(int index) {
    selectIndex = index;
    update();
  }

  /// 点击展开菜单
  /// [index] 索引
  void selectExpandMenu(int index) {
    selectIndex = index;
    Get.back();
    update();
  }
}
